<!-- $Id: agency_info.htm 14216 2008-03-10 02:27:21Z testyang $ -->
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,../js/region.js,listtable.js"}

<div class="main-div">
 <div id="tabbar-div">
    <p>
      <span class="tab-front" id="general-tab">基本信息</span>
     
      <span class="tab-back" id="bank-tab">开户行</span>
      <!-- {if 0} -->
      <span class="tab-back" id="detail-tab">相关资质</span>
      <!-- {/if} -->
      <span class="tab-back" id="content-tab">详细描述</span>
      <!-- {if 0} -->
      <span class="tab-back" id="gallery-tab">广告轮播</span>
      <!-- {/if} -->
      
    </p>
  </div>
  <div id="tabbody-div">
<form method="post" action="suppliers.php" name="theForm" enctype="multipart/form-data" onsubmit="return validate();">
<!--

<form method="post" action="suppliers.php" name="theForm" enctype="multipart/form-data" >-->

<table cellspacing="1" cellpadding="3" width="100%" id="general-table">
  <tr>
    <td class="label">{$lang.label_suppliers_name}</td>
    <td><input type="text" name="suppliers_name"  size="50" value="{$suppliers.suppliers_name}" />{$lang.require_field}</td>
  </tr>

  <tr>
    <td class="label">店长姓名：</td>
    <td>  <input name="real_name" type="text" size="40" id="real_name" class="input"  value="{$suppliers.real_name}" /></td>
  </tr>

  <tr>
    <td class="label">所属行业：</td>
    <td>  
      <select name="hangye_id" id="hangye_id">
        <option value="">请选择</option>
        {foreach from=$hangye item=item}
        <option value="{$item.id}" {if $item.id eq $suppliers.hangye_id}selected="selected"{/if}>{$item.name}</option>
        {/foreach}
      </select>
    </td>
  </tr>
  
   
          
          
           <tr>
          <td class="label">经营区域：</td>
          <td>
		  <select name="city_id" id="selCities"  onchange="region.changed(this, 3, 'selDistricts')">
          <option value='1'>全国</option>
            {foreach from=$cities item=region}
              <option value="{$region.region_id}" {if $region.region_id eq $suppliers.city_id}selected="selected"{/if}>{$region.region_name}</option>
            {/foreach}

        </select>
         <select name="district_id" id="selDistricts">

				<option value="0">请选择</option>

				{foreach from=$district_list item=district}

				<option value="{$district.region_id}" {if $district.region_id eq $suppliers.district_id}selected="selected"{/if}  >{$district.region_name}</option>

				{/foreach}

		</select> 
          </td>
        </tr>

         <tr>
          <td class="label">详细地址：</td>
          <td>
          <input name="address" type="text" size="40" id="address"  class="input"  value="{$suppliers.address}"/>
          </td>
        </tr>
        
        <tr>
          <td class="label">手机号码：</td>

          <td>

          <input name="phone" type="text" size="40" id="phone"   class="input"  value="{$suppliers.phone}"  />

            <span id="phone_notice" style="color:#FF0000"> *</span>

          </td>
        </tr>
        
        
        <tr>
          <td class="label">邮箱地址：</td>
          <td>
          <input name="email" type="text" size="40" id="email"   class="input"  value="{$suppliers.email}"  />
           
          </td>
        </tr>
        
        
        
        
        
        
        
        
        
        
        
          <tr>
          <td class="label">在线客服：</td>
          <td>
          <input name="qq" type="text"  size="40" class="input"  value="{$suppliers.qq}" />
            <span style="color:#FF0000" id="password_notice"> *</span>
          </td>
        </tr>
        <!-- {if 0} -->
         <tr>
           <td class="label">备用手机</td>
           <td><input name="phone1" type="text" size="40" id="phone1" class="input"  value="{$suppliers.phone1}" /></td>
         </tr>
         
           <tr>
             <td class="label">推荐人：</td>
             <td>  <input name="recommend_person" type="text"  size="40" class="input"  value="{$suppliers.recommend_person}" /></td>
           </tr>
           <!-- {/if} -->
              <tr>
                <td class="label">用户名：</td>
                <td><input name="user_name" type="text" size="20"   class="input"  value="{$suppliers.user_name}"/></td>
              </tr>
              <tr>
                <td class="label">密码：</td>
                <td><input name="password" type="text" size="20"  class="input"  /></td>
              </tr>
              <tr>
                <td class="label">平台佣金比例：</td>
                <td>
                <input name="percentage" type="text" size="20"  class="input"  value="{if $suppliers.percentage gt 0}{$suppliers.percentage}{else}{$cfg_percentage}{/if}" />
                <span style="color:#FF0000" id="percentage_notice"> %</span>
                </td>
              </tr>
<!--               <tr>
                <td class="label">一级分销佣金比例：</td>
                <td>
                <input name="rate_1" type="text" size="20"  class="input"  value="{if $suppliers.rate_1}{$suppliers.rate_1}{else}0.00{/if}" />
                <span style="color:#FF0000" id="rate_1_notice"> %</span>
                </td>
              </tr>
              <tr>
                <td class="label">二级分销佣金比例：</td>
                <td>
                <input name="rate_2" type="text" size="20"  class="input"  value="{if $suppliers.rate_2}{$suppliers.rate_2}{else}0.00{/if}" />
                <span style="color:#FF0000" id="rate_2_notice"> %</span>
                </td>
              </tr>
              <tr>
                <td class="label">三级分销佣金比例：</td>
                <td>
                <input name="rate_3" type="text" size="20"  class="input"  value="{if $suppliers.rate_3}{$suppliers.rate_3}{else}0.00{/if}" />
                <span style="color:#FF0000" id="rate_3_notice"> %</span>
                </td>
              </tr> -->
  {if $suppliers.suppliers_id}
  {if $suppliers.user_id}
  <tr>
    <td class="label">解绑店主二维码：</td>
    <td><div id="qrcode"></div></td>
  </tr>
  {else}
  <tr>
    <td class="label">绑定店主二维码：</td>
    <td><div id="qrcode"></div></td>
  </tr>
  {/if}
  <script src="/js/jquery.js"></script>
  <script src="/js/qrcode.js"></script>
<script type="text/javascript">
var suppliers_id = {$suppliers.suppliers_id};
var uri = {if $suppliers.user_id}'unbind'{else}'bind'{/if};
var qrcode = new QRCode(document.getElementById("qrcode"), {
    text: location.origin + "/"+uri+".php?suppliers_id="+suppliers_id,
    width: 128,
    height: 128,
    colorDark : "#000000",
    colorLight : "#ffffff",
    correctLevel : QRCode.CorrectLevel.H
});
</script>
  {/if}           
</table>
<table width="90%" id="gallery-table" style="display:none">
{if $photo_list}
         {foreach from=$photo_list item=list}
					<tr id="gallery_{$list.photo_id}">
                      <td width="10">
                      
                      <a href="javascript:;" onclick="if (confirm('确定要删除吗')) dropImg('{$list.photo_id}')">[-]</a> {if $list.photo_file}{$list.photo_file},链接:{$list.link}<a  href="./../{$list.photo_file}" target="_blank">查看</a>{/if}</td>
                    </tr>                    
                    {/foreach}
{else}
	<tr id="gallery_{$list.photo_id}">
                      <td width="10">
                      http://www.900nong.com/themes/default/images/flexslider.jpg <a  href="http://www.900nong.com/themes/default/images/flexslider.jpg" target="_blank">查看</a>
     </td>
     </tr>

{/if}
</table>
<table width="90%" id="content-table" style="display:none">
 <tr>
 <td class="label">商家描述：</td>
 <td>
{$FCKeditor}

 </td>
 </tr>
</table>

<table width="90%" id="bank-table" style="display:none">
 <tr>
  <td class="label">开户行名称：</td>
  <td><input name="bank_name"  id='bank_name' type="text" class="input" value="{$supp_row.bank_name}" />可以输入50个汉字字符
    </td>
</tr>
<tr>
  <td class="label">开户行姓名：</td>
  <td><input type="text" name="bank_p_name" id='bank_p_name' class="input" value="{$supp_row.bank_p_name}" />
可以输入个10汉字或字母</td>
</tr>
     <tr>
          <td class="label">开户行账号：</td>
          <td>
            <input type="text" name="bank_account" id='bank_account' class="input"  value="{$supp_row.bank_account}" /> 可以输入20个数字
          </td>
        </tr>
 
</table>


<table width="90%" id="detail-table" style="display:none">
 <tr>
  <td class="label">营业执照：</td>
  <td><input name="business_license" type="file"  size="40" />
    {if $suppliers.business_license}<a  href="./../{$suppliers.business_license}" target="_blank">查看</a>{/if}
    </td>
</tr>
<tr>
  <td class="label">身份证：</td>
  <td><input name="cards" type="file"  size="40" />
    {if $suppliers.cards}<a  href="./../{$suppliers.cards}" target="_blank">查看</a>{/if}</td>
</tr>
     <tr>
          <td class="label">组织机构代码证：</td>
          <td>
            <input name="business_scope" id="business_scope" type="file" >
          {if $suppliers.business_scope}
          <a href="./../{$suppliers.business_scope}" target="_blank">查看</a>
          {/if}
          </td>
        </tr>
   <tr>
          <td align="right">税务登记证：</td>
          <td>
            <input name="certificate" id="certificate" type="file" >
        
          {if $suppliers.certificate}
          <a href="./../{$suppliers.certificate}" target="_blank">查看</a>
          {/if}
          </td>
        </tr>

</table>
 <div class="button-div">
    <input type="submit" class="button" value="{$lang.button_submit}" />
     <!--   <input type="button" class="button" value="{$lang.button_submit}" onclick="return validate()" />-->

      <input type="reset" class="button" value="{$lang.button_reset}" />

      <input type="hidden" name="act" value="{$form_action}" />
      <input type="hidden" name="page" value="{$page}" />
	
      <input type="hidden" name="id" value="{$suppliers.suppliers_id}" /></td>
    </div>
</form>
</div>
</div>



{literal}

<script language="JavaScript">
function validate()
{
	if(document.theForm.suppliers_name.value=='')
	{
		alert('请添加商家名称');
		return false;
	}
	if(document.theForm.phone.value=='')
	{
		alert('请添加商家手机号码');
		return false;
	}
	
	return true;
	
}


<!--
document.forms['theForm'].elements['suppliers_name'].focus();
function get_site_list(id)
{
  Ajax.call('suppliers.php', 'act=get_sitelist&province_id=' + id ,site_listresponse, "GET", "JSON");
	
}
function site_listresponse(result)
{
	 document.getElementById('selCities').innerHTML = result.content;
}

onload = function()

{

    // 开始检查订单

    startCheckOrder();

}

region.isAdmin = true;
document.getElementById("tabbar-div").onmouseover = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-back")
    {
        obj.className = "tab-hover";
    }
}

document.getElementById("tabbar-div").onmouseout = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-hover")
    {
        obj.className = "tab-back";
    }
}

document.getElementById("tabbar-div").onclick = function(e)
{
    var obj = Utils.srcElement(e);

    if (obj.className == "tab-front")
    {
        return;
    }
    else
    {
        objTable = obj.id.substring(0, obj.id.lastIndexOf("-")) + "-table";

        var tables = document.getElementsByTagName("table");
        var spans  = document.getElementsByTagName("span");

        for (i = 0; i < tables.length; i++)
        {
            if (tables[i].id == objTable)
            {
                tables[i].style.display = (Browser.isIE) ? "block" : "table";
            }
            else
            {
                tables[i].style.display = "none";
            }
        }
        for (i = 0; spans.length; i++)
        {
            if (spans[i].className == "tab-front")
            {
                spans[i].className = "tab-back";
                obj.className = "tab-front";
                break;
            }
        }
    }
}


/**

 * 检查表单输入的数据

 */



function selectshowtype(val)
{
	if(val.value =='1')
	{
		document.getElementById('show_type_html').style.display = 'none';
	}
	else
	{
		document.getElementById('show_type_html').style.display = 'block';
	}
}

function s_type(val){

		if(val=='private'){

			tab1.style.display="table-row";

			tab2.style.display="none";	

		}else if(val=='conmpany'){

			tab1.style.display="none";

			tab2.style.display="table-row";	

		}

	}

	

	

	

	

	

/**

 * 添加图片

**/

  function addImg(obj)

  {

	 

	  var src  = obj.parentNode.parentNode; 

	 

	  var idx  = rowindex(src);

      var tbl  = document.getElementById('gallery-table');

	 

      var row  = tbl.insertRow(idx + 1);

	  

      //var cell = row.insertCell(-1);

      row.innerHTML = src.innerHTML.replace(/(.*)(addImg)(.*)(\[)(\+)/i, "$1removeImg$3$4-");

	  

    

  }

  

  

  function removeImg(obj)

  {

      var row = rowindex(obj.parentNode.parentNode);

      var tbl = document.getElementById('gallery-table');

      tbl.deleteRow(row);

  }





  /**

   * 删除已上传图片

   */

  function dropImg(imgId)

  {

    Ajax.call('suppliers.php?act=drop_image', "img_id="+imgId, dropImgResponse, "GET", "JSON");

  }



  function dropImgResponse(result)

  {

      if (result.error == 0)

      {

          document.getElementById('gallery_' + result.content).style.display = 'none';

      }

  }

//-->

</script>

{/literal}

{include file="pagefooter.htm"}